package utils

import (
	"github.com/jordan-wright/email"
	"net/smtp"
)

// 用来通过邮箱来发送验证码
func SendCode(toUserEmail, code string) error {
	e := email.NewEmail()
	e.From = "Get <cy15770703229@163.com>"
	//设置接收方的邮箱
	e.To = []string{toUserEmail}
	e.Subject = "验证码已发送，请查收"
	e.HTML = []byte("您的验证码：<b>" + code + "</b>")
	return e.Send("smtp.163.com:25", smtp.PlainAuth("", "cy15770703229@163.com", "BYHBMFMPYYXNFKTJ", "smtp.163.com"))
}
